#include "Hatter.hh"
#include "../Globals.hh"
#include "../Network/XmlClient.hh"
#include <QtGui>

using namespace Network;
using namespace Geom;


Hatter::Hatter(QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
	setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	setMinimumSize(2048, 2028);
	setMaximumSize(2048, 2048);
}

Hatter::~Hatter()
{

}

void Hatter::paintEvent(QPaintEvent* ev)
{
	DONTCARE(ev);
	QPainter painter(this);
	QRect qrect;
	qrect.setSize(size());
	painter.fillRect(qrect, QBrush(QColor("black")));
}

void Hatter::mousePressEvent(QMouseEvent* ev) {
	if (ev->buttons() & Qt::RightButton) {
		Vector<> const pos(ev->pos().x(), ev->pos().y());
		Vector<> const sizeVec(size().width(), size().height());
		Vector<> const v = client_to_server(pos, sizeVec);
		XmlClient::instance().move_selected_fleet(v);
	}
}

